<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:tk="http://www.qdocuments.net" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.qdocuments.net" elementFormDefault="qualified">
  <xs:import schemaLocation="Data.xsd"/>
  <xs:element name="Table">
    <xs:complexType>
      <xs:sequence maxOccurs="unbounded">
        <xs:element ref="tk:Field"/>
      </xs:sequence>
      <xs:attribute name="TableName" type="xs:string" use="required"/>
      <xs:attribute name="TableDesc" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Field">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="FieldName" type="xs:string"/>
        <xs:element name="DisplayName" type="xs:string"/>
        <xs:element name="Length" type="xs:unsignedInt" minOccurs="0"/>
        <xs:element name="CodeTable" type="xs:string" minOccurs="0"/>
        <xs:element ref="tk:EasySearch" minOccurs="0"/>
        <xs:element ref="tk:Display" minOccurs="0"/>
        <xs:element ref="tk:Extension" minOccurs="0"/>
        <xs:element ref="tk:Insert" minOccurs="0"/>
        <xs:element ref="tk:Update" minOccurs="0"/>
        <xs:element ref="tk:Detail" minOccurs="0"/>
        <xs:element ref="tk:List" minOccurs="0"/>
        <xs:element ref="tk:Upload" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="IsKey" type="xs:boolean"/>
      <xs:attribute name="IsEmpty" type="xs:boolean"/>
      <xs:attribute name="DataType" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="Date"/>
            <xs:enumeration value="double"/>
            <xs:enumeration value="text"/>
            <xs:enumeration value="string"/>
            <xs:enumeration value="DateTime"/>
            <xs:enumeration value="int"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="EditStyle">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="UpdateID"/>
            <xs:enumeration value="Key"/>
            <xs:enumeration value="CreateID"/>
            <xs:enumeration value="UpdateDate"/>
            <xs:enumeration value="CreateDate"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="EasySearch">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="RefValue" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="RegName" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Display">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Link" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="IsTwoColumn" type="xs:boolean"/>
      <xs:attribute name="ListRef" type="xs:boolean"/>
      <xs:attribute name="ReadOnly" type="xs:boolean"/>
      <xs:attribute name="ListWidth" type="xs:unsignedInt"/>
      <xs:attribute name="Format" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Extension">
    <xs:complexType mixed="true">
      <xs:complexContent mixed="true">
        <xs:restriction base="xs:anyType">
          <xs:attribute name="Search">
            <xs:simpleType>
              <xs:restriction base="xs:NMTOKEN">
                <xs:enumeration value="title"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="ImgClick" type="xs:string"/>
          <xs:attribute name="DateSpan" type="xs:boolean"/>
          <xs:attribute name="CheckValue" type="xs:string"/>
        </xs:restriction>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="Insert" type="InsertType"/>
  <xs:element name="Update" type="HtmlCtrlType"/>
  <xs:element name="Detail" type="HtmlCtrlType"/>
  <xs:element name="List">
    <xs:complexType>
      <xs:attribute name="HtmlCtrl">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="Text"/>
            <xs:enumeration value="CheckBox"/>
            <xs:enumeration value="Combo"/>
            <xs:enumeration value="EasySearch"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="Order" type="xs:unsignedInt" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Upload">
    <xs:complexType>
      <xs:attribute name="Kind" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="DB"/>
            <xs:enumeration value="File"/>
            <xs:enumeration value="FileDB"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="ServerPathField" type="xs:string" use="required"/>
      <xs:attribute name="ContentField" type="xs:string" use="required"/>
      <xs:attribute name="MimeTypeField" type="xs:string" use="required"/>
      <xs:attribute name="SizeField" type="xs:string" use="required"/>
      <xs:attribute name="MaxSize" type="xs:unsignedInt" default="100"/>
      <xs:attribute name="FileExt">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:pattern value="(.[a-zA-Z]+)*(\[(.[a-zA-Z]+)*\])?"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="OnUploadedEvent" type="xs:string"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
